home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 1810 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.0 KB

  1. Path: newsbf02.news.aol.com!not-for-mail
  2. From: jritzau@aol.com (JRitzau)
  3. Newsgroups: comp.lang.c++
  4. Subject: ifstream slower than fread()?
  5. Date: 12 Jan 1996 20:00:31 -0500
  6. Organization: America Online, Inc. (1-800-827-6364)
  7. Sender: root@newsbf02.news.aol.com
  8. Message-ID: <4d707f$j2@newsbf02.news.aol.com>
  9. Reply-To: jritzau@aol.com (JRitzau)
  10. NNTP-Posting-Host: newsbf02.mail.aol.com
  11.  
  12. Hello!
  13.  
  14. I was thinking iostreams of C++ are the best way to read
  15. and write binary files. But after testing I must see, that
  16. to copy a file with 'old' C-functions fwrite()/fread() do
  17. the job in just about half the time it was done using
  18. ifstream.read()/ofstream.write()?!
  19.  
  20. Is this a common disadvantage of streams or does this depend
  21. on the C++ Compiler used? I'm working with Borland Turbo 
  22. C++ 3.0 for DOS.
  23.  
  24. Next problem: I've read that I must call the function 
  25. ios::sync_with_stdio() if one program uses printf() AND cout.
  26.  
  27. Is there also a need for this synchronisation if I use 
  28. fread()/fwrite() (no printf())  AND cin/cout in the same
  29. program?
  30.  
  31.  
  32. Thanks for any hints.
  33. Juergen
  34.